package com.dyh.quickdemo.demos.lbdbean2;

import com.alibaba.fastjson.JSON;
import groovy.lang.Tuple2;
import org.assertj.core.util.Lists;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.util.StringUtils;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.function.Predicate;

/*
@Author=Joey Wheeler
@Date=2021/1/28 11:37
*/
@Configuration
public class MyPredicateConfig {

    @Bean
    Predicate<Long> biggerThan1(){
        return e->e>1;
    }

    /*Predicate<Long>  biggerThan1 pass*/
    @Bean
    Predicate<Long> biggerThan2(Predicate<Long>  biggerThan1){
        return biggerThan1.and(e->e>2);
    }

    public static void main(String[] args) {
        String str = "";
        System.out.println(
                Optional.ofNullable(str).filter(e->!StringUtils.isEmpty(e))
                        .orElse("dawd")
        );
    }
}
